﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using LiveMakkah.Models;
using LiveMakkah.Services;
using LiveMakkah.Utils;
using Xamarin.Forms;

namespace LiveMakkah.ViewModels

{
    internal class ChannelViewModel : BaseViewModel
    {
        private FarahnakModel _selectedChannel;
        private UrlWebViewSource _channelUrl;

        public ChannelViewModel(FarahnakModel selectedchannel)
        {
            Selectedchannel = selectedchannel;

        }

        public FarahnakModel Selectedchannel
        {
            get { return _selectedChannel; }
            set
            {
                _selectedChannel = value;
                SetChannelUrl();
            }
        }

        private void SetChannelUrl()
        {
            ChannelUrl = new UrlWebViewSource
            {
                Url = "https://www.youtube.com/embed/" + Selectedchannel.Link + "?t=10",
            };
        }

        public UrlWebViewSource ChannelUrl
        {
            get { return _channelUrl; }
            set
            {
                _channelUrl = value;
                OnPropertyChanged();
            }         
        }
    }
}
